<?php
namespace Client\Table;

use Zend\Db\Sql\Select;
use Zend\Paginator\Adapter\DbSelect;

use Zend\Paginator\Paginator;
use Zend\Db\Sql\Where;
use Zend\Db\ResultSet\ResultSet;

class BannerTable extends CommonTable
{
    protected $table = 'hy_banner';
    protected $id = 'banner_id';
    
    public function find($type, $limit = 6) {
        
        $select = new Select();
        $select ->from($this->getTable())
        ->columns(array('banner_id', 'url', 'image'))
        ->where(array('type' => $type))
        ->order('banner_id DESC')
        ->limit($limit);
        $rowset = $this->selectWith($select);
        return $rowset->toArray();
    }
    
    public function getItems($type){
    	$select = new Select();
    	$select ->from($this->getTable())
	    	->columns(array('banner_id', 'url', 'image'))
	    	->where(array('type' => $type))
	    	->order('banner_id DESC');
    	$rowset = $this->selectWith($select);
    	return $rowset->toArray();
    }

 
}